Hi all, |
Re: comparing attribute definitions Something like this, but you need to add your own error reporting.
bool IsAttrSame(string in_NameAttr, Module in_mReference, in_mLive)
{ // Is this attribute defined the same in both the Reference and Live modules?
AttrDef adR = find(in_mReference, in_NameAttr)
AttrDef adL = find(in_mLive, in_NameAttr)
bool Same = true
if ( null adR and null adL) then { Neither exists; return(false)}
if ( null adR and !null adL) then { adL only exists; return(false)}
if (!null adR and null adL) then { adR only exists; return(false)}
// both exist:
if (adR.typeName != adL.typeName) {type mismatch; Same = false}
if (adR.multi != adL.multi) {multi mismatch; Same = false}
if (adR.(bool defval) != adL.(bool defval) ) {HasDefault mismatch; Same = false}
if (adR.(string defval) != adL.(string defval) ) {Default Value mismatch; Same = false}
// I have doubts about the above line.
... ditto for nobars, nochanges, nohistory, inherit, bool dxl, string dxl, module, object,
description, and I suppose: canWrite, useraccess, system, hidden.
phew.
return(Same)
} // end IsAttrSame()
Skip skpNames = createString() // KEY and DATA both 'string' NameAttr
for Name in mReference do {put(skpNames, Name, Name)}
for Name in mLive do {put(skpNames, Name, Name)
for Name in skpNames do
{ IsSameAttr(mReference, mLive, Name)
}
delete(skpNames)
|
Re: comparing attribute definitions llandale - Thu Apr 04 13:27:12 EDT 2013 Something like this, but you need to add your own error reporting.
bool IsAttrSame(string in_NameAttr, Module in_mReference, in_mLive)
{ // Is this attribute defined the same in both the Reference and Live modules?
AttrDef adR = find(in_mReference, in_NameAttr)
AttrDef adL = find(in_mLive, in_NameAttr)
bool Same = true
if ( null adR and null adL) then { Neither exists; return(false)}
if ( null adR and !null adL) then { adL only exists; return(false)}
if (!null adR and null adL) then { adR only exists; return(false)}
// both exist:
if (adR.typeName != adL.typeName) {type mismatch; Same = false}
if (adR.multi != adL.multi) {multi mismatch; Same = false}
if (adR.(bool defval) != adL.(bool defval) ) {HasDefault mismatch; Same = false}
if (adR.(string defval) != adL.(string defval) ) {Default Value mismatch; Same = false}
// I have doubts about the above line.
... ditto for nobars, nochanges, nohistory, inherit, bool dxl, string dxl, module, object,
description, and I suppose: canWrite, useraccess, system, hidden.
phew.
return(Same)
} // end IsAttrSame()
Skip skpNames = createString() // KEY and DATA both 'string' NameAttr
for Name in mReference do {put(skpNames, Name, Name)}
for Name in mLive do {put(skpNames, Name, Name)
for Name in skpNames do
{ IsSameAttr(mReference, mLive, Name)
}
delete(skpNames)
that's what I feared. I was sort of hoping there was a simpler way than to write my own compare function, because I assume that there's something similar going on when you import attributes from another module. Thanks again. Karl |